package com.logic.login;

import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.SQLException;

import com.factory.db.DBFactory;

public class UserLoginAction {

	public String userLoginRlt( String phoneNum, String pwd ){
		Connection conn = null;
		
		CallableStatement cst = null;
		
		String back = "";
		
		conn = DBFactory.getDBConnectionInstance( DBFactory.TYPE_MYSQL ).getDBConnection();

		String sql = "{call db.webuserlogin_proc(?,?,?)}";

		try {
			cst = conn.prepareCall( sql );

			cst.setString(1, phoneNum );
			cst.setString(2, pwd );

			cst.registerOutParameter( 3, java.sql.Types.VARCHAR );

			cst.execute();

			back = cst.getString( 3 );
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}finally{

			if( cst != null ){
				
				try {
					cst.close();
					
					cst = null;
				} catch (SQLException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
				
			}

		}

		return back;
	
		
		
	}
	
	
}
